pkgname=kdelibs4support
pkgver=5.37.0
pkgrel=1
pkgdesc='Porting aid from KDELibs4'
arch="all"
url='https://community.kde.org/Frameworks'
license="LGPL"
depends="kunitconversion kitemmodels kemoticons kded kparts"
makedepends="extra-cmake-modules kdoctools-dev qt5-qttools-dev networkmanager perl-uri
			 python kdesignerplugin kunitconversion-dev kemoticons-dev kded-dev kparts-dev qt5-qtsvg-dev
			 qt5-x11extras-dev kcompletion-dev kconfig-dev kconfigwidgets-dev kauth-dev kcodecs-dev kwidgetsaddons-dev
			 kcrash-dev kglobalaccel-dev kservice-dev kguiaddons-dev ki18n-dev kiconthemes-dev kbookmarks-dev
			 kitemviews-dev kjobwidgets-dev solid-dev kxmlgui-dev knotifications-dev ktextwidgets-dev sonnet-dev
			 kwindowsystem-dev kdbusaddons-dev kdesignerplugin-dev kbookmarks-dev kcoreaddons-dev kio-dev
			 kded"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/portingAids/${pkgname}-${pkgver}.tar.xz"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"

prepare() {
	mkdir -p $srcdir/build
}

build() {
	cd $srcdir/build
	cmake "$srcdir"/${pkgname}-${pkgver} \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DKDE_INSTALL_LIBDIR=lib \
		-DKDE_INSTALL_LIBEXECDIR=lib \
		-DBUILD_TESTING=OFF
	make
}

package() {
	cd $srcdir/build
	make DESTDIR="${pkgdir}" install

	# cert bundle seems to be hardcoded
	# link it to the one from ca-certificates
	rm -f "$pkgdir"/usr/share/kf5/kssl/ca-bundle.crt
	ln -sf /etc/ssl/certs/ca-certificates.crt "${pkgdir}"/usr/share/kf5/kssl/ca-bundle.crt

	chmod 0644 $pkgdir/usr/lib/kf5/fileshareset # remove suid bit as it's disallowed by Alpine standards due to being a security risk
}
sha512sums="c56d821d8f6cea31df7a1138ff050818fd38764fc7bd63de1c125921b86f00144eac7d569c40b2fe0dcd8fc4f006a0ba8af93fba2feab2d4a3fca1a8a1fa3ca7  kdelibs4support-5.37.0.tar.xz"
